/***********************************************************************
    filename:   DaterEventBlockWindow.h
    created:    10/4/2012
    author:     4Ys

    purpose:    Defines class for EventBlockWindow objects in UI
*************************************************************************/
#ifndef _DaterEventBlockWindow_h_
#define _DaterEventBlockWindow_h_

#include "cegui.h"
#include "DaterBaseWindow.h"
#include "DaterEvent.h"

#include <vector>

class EventBlockWindow : public BaseWindow
{
	/* !
	\brief
		The Event block in week version of events.
	*/
public:
		/* !
		\brief
			Construct the sample of class EventBlockWindow.

		\param index
			- The index of the tag.
			
		\param relatedEvent
			- The event related to the tag.
			
		\param year
			- The year of the event related.
			
		\param yearDay
			- The year Day of the event related.
			
		\param parent
			- point to parent window.
		*/
	EventBlockWindow(int index, Dater::Event* relatedEvent, int year, int yearDay, CEGUI::Window* parent = 0);
		
		/* !
			Destructor of class EventTagWindow.
		*/
	~EventBlockWindow();

		/* !
		\brief
			a virtual function generated from class BaseWindow to show window.
		*/
	virtual void showWindow();
	
		/* !
		\brief
			a virtual function generated from class BaseWindow to hide window.
		*/
	virtual void hideWindow();

		/* !
		\brief
			Get the block number.
		*/
	int getBlockNum();
	
		/* !
		\brief
			Get the block amount.
		*/
	int getBlockAmount();
	
		/* !
		\brief
			Get the block amount updated.
		*/
	bool getHasUpdatedBlockAmount();
	
		/* !
		\brief
			Get the block vector getConflitBlocks.
		*/
	std::vector<EventBlockWindow*> getConflitBlocks();
	
		/* !
		\brief
			Get the event related to the event.
		*/
	Dater::Event* getRelatedEvent();

		/* !
		\brief
			Set the block number .
		*/
	void setBlockNum(int blockNum);
	
		/* !
		\brief
			Set the block amount.
		*/
	void setBlockAmount(int blockAmount);
	
		/* !
		\brief
			Set the block amount updated.
		*/
	void setHasUpdatedBlockAmount(bool setting);
	
		/* !
		\brief
			Set the block vector getConflitBlocks.
		*/
	void pushToConflitBlocks(EventBlockWindow*);

private:
		/* !
		\brief
			Handle the process and add brief event to the window.
			
		\param args
			- the processing program.
		*/
	bool handle_addBriefEventWindow(const CEGUI::EventArgs& args);
	
		/* !
		\brief
			Handle the process and destroy brief event in the window.
			
		\param args
			- the processing program.
		*/
	bool handle_destroyBriefEventWindow(const CEGUI::EventArgs& args);
	
		/* !
		\brief
			Handle the process and delete event from the window.
			
		\param args
			- the processing program.
		*/
	bool handle_deleteEvent(const CEGUI::EventArgs& args);
	
		/* !
		\brief
			Handle the process and edit event in the window.
			
		\param args
			- the processing program.
		*/
	bool handle_editEvent(const CEGUI::EventArgs& args);

		//! A map contains related group events of a certain group.
	Dater::Event* _relatedEvent;
	int _year;
	int _yearDay;
	
		//! Represent whether the event window is attached.
	bool bEventWindowAttached;
	int _blockNum;
	int _blockAmount;

		//! A vector contains event block windows of the process.
	std::vector<EventBlockWindow*> _conflitBlocks;
	bool hasUpdatedBlockAmount;
};

#endif